$(function(){
	
	$("#hotel_search").click(function(){
		searchHotel();
	});
	$("#hotel_search_sort").change(function(){
		searchHotel();
	});
	$("#s_city").focus(function(){
		if($(this).val()=="贵阳市"){
			$(this).val("");
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).val("贵阳市");
		}
	});
	
});
function searchHotel(page){
	var city=$("#s_city").val();
	var level=$("#hotel_level").val();
	var hotelName=$("#hotel_name").val();
	var url="searchHotel.htm";
	var priceRange=$("#price_range").val();
	var sort=$("#hotel_search_sort").val();
	if(city==""){
		alert("请输入城市");
		return;
	}else{
		url+="?city="+city+"&price="+priceRange;
	}
	if(level!=undefined && level !=""){
		url+="&level="+level;
	}
	if(hotelName!=undefined && hotelName !=""){
		url+="&name="+hotelName;
	}
	if(sort!=undefined && sort !=""){
		url+="&sort="+sort;
	}
	if(page!=undefined && page !=""){
		url+="&page="+page;
	}
	window.location.href=	(url);
}
function searchContent(chType,page,channel){
	if(!IsNull(channel)){
		window.location.href="listView.htm?channel="+channel+"&page="+page;
	}else{
		var title=$("#search_title").val();
		var url="searchContent.htm";
		if(title==""){
			alert("请输入搜索条件");
		}else{
			url+="?title="+title+"&chType="+chType;
			if(!IsNull(page)){
				url+="&page="+page;
			}
			
			window.location.href=encodeURI(url);
		}
	}
}
function radioSearch(chType){
	var h1=$("#search_h1");
	$("#search_content_btn").click(function(){
		searchContent(chType);
	});
	if(chType=="hotel"){
		$("#search_hotel").show();
		$("#search_content").hide();
	}else{
		$("#search_hotel").hide();
		$("#search_content").show();
		if(chType=="ticket"){
			h1.html("搜索门票");
		}else if(chType=="line"){
			h1.html("线路搜索");
		}else if(chType=="travel"){
			h1.html("旅游商品搜索");
		}
	}
}
function searchScenic(page){
	var searchScenic=$("#scenic_search").val();
	if(searchScenic!="" && searchScenic!=undefined && searchScenic!=null){
		if(page==null || page=="" || page==undefined){
			page=1;
		}
		window.location.href=encodeURI("searchscenic.htm?name="+searchScenic+"&city="+searchScenic+"&page="+page);
	}
}